package com.sicheng.datastruct.tree;


import static com.sicheng.datastruct.tree.utils.TreeUtil.levelTraversal;
import static com.sicheng.datastruct.tree.utils.TreeUtil.swap;

/**
 * @author zsc
 * @version 1.0
 * @date 2021/9/27 17:00
 */
public class MirrorTree {
    public static void mirror(HeroNode root) {
        if (root == null)
            return;
        swap(root);
        mirror(root.left);
        mirror(root.right);
    }

    public static void main(String[] args) {
        ReBuildBinaryTree buildBinaryTreeTool =
                new ReBuildBinaryTree(new Integer[]{3, 9, 20, 15, 7}, new Integer[]{9, 3, 15, 20, 7});

        HeroNode root = buildBinaryTreeTool.rebuild();
        mirror(root);

        levelTraversal(root);
    }

}
